<!DOCTYPE html>

<head>
<title>Formative Assessment</title>
<script type="text/javascript" src="scripts/jquery-1.11.0.min.js"></script>
<script src="scripts/scripts.js" type="text/javascript"></script>
<link rel="stylesheet" href="styles/styles.css" type="text/css" />
<script type="text/javascript" src="scripts/jquery.js"></script>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body onload="shuffle()">
<?php 
require_once'config.php';
require_once'functions.php';
$getQuestion = getQuestion($currentQuestion);
$studentID = $_SESSION['studentID'];
$testID = 1;
$getAttempts = getAttempts($studentID);	
	
if ($_SERVER['REQUEST_METHOD'] == 'POST')
{

	$_SESSION['attempt'] = $_POST['attempt']; 
	$attempt = $_SESSION['attempt'];

	$num = $_POST['num'];
	$currentQuestion = $num;
	
	$_SESSION['score'] = $_POST['score']; 
	$score = $_SESSION['score'];
	
	$getAttempts = getAttempts($studentID);

	
}
if ($SESSION['finished'] = true)
{
	
	$_SESSION['attempt'] = $_POST['attempt']; 
	$attempt = $_SESSION['attempt'];
}

$getQuestion = getQuestion($currentQuestion);

if ($getQuestion['type'] == "multiple-choice")
{
	$displayMC = "block";
	}
if ($getQuestion['type'] == "checkbox")
{
	$questionOptions = "questionOptions[]";
	$displayCB = "block"; 
		}
if ($getQuestion['type'] == "true-false")
{
	$displayTF = "block"; 
	}
?>
<header>Learner Centred Design Formative Assessment<span class="loggedIn">Logged in as:<?php echo ucfirst($_SESSION['firstName']);?>&nbsp;&nbsp;<!--<a href="logout.php">Logout</a>--></span></header>
<!--<nav>
<?php include 'nav.php' ?>
</nav>-->
<div id="container" class="one-edge-shadow">
<progress id='progress' value='<?php echo $currentQuestion ?>' max='11'> <?php echo $currentQuestion ?> </progress>
<div id="mainContent">
  <div id="resource"> <?php echo $getQuestion['resource'] ?> </div>
  <div id="quiz">
    <form id="question" action="quizhandler.php" method="post" >
      <h2>Question <?php echo $getQuestion['questionID']; ?> </h2>
      <p class="itemStem"> <?php echo $getQuestion['stem'] ?> </p>
      <div id = "qtypes">
        <div id="multiple-choiceQuestion" style="display:<?php echo $displayMC ?>">
          <div class="shufflyMC">
            <input name="<?php echo $questionOptions; ?>" id="inpMcRadio1" type="radio" value="<?php echo $getQuestion['option1'] ?>">
            <label id="lblMcRadio1" for="inpMcRadio1"> <?php echo $getQuestion['option1'];?> </label>
          </div>
          <div class="shufflyMC">
            <input name="<?php echo $questionOptions; ?>" id="inpMcRadio2" type="radio" value="<?php echo $getQuestion['option2'] ?>">
            <label id="lblMcRadio2" for="inpMcRadio2"> <?php echo $getQuestion['option2'] ?> </label>
          </div>
          <div class="shufflyMC">
            <input name="<?php echo $questionOptions; ?>" id="inpMcRadio3" type="radio" value="<?php echo $getQuestion['option3'] ?>">
            <label id="lblMcRadio3" for="inpMcRadio3"> <?php echo $getQuestion['option3'] ?> </label>
          </div>
          <div class="shufflyMC">
            <input name="<?php echo $questionOptions; ?>" id="inpMcRadio4" type="radio" value="<?php echo $getQuestion['option4'] ?>">
            <label id="lblMcRadio4" for="inpMcRadio4"> <?php echo $getQuestion['option4'] ?> </label>
          </div>
        </div>
        <div id="true-falseQuestion" style="display:<?php echo $displayTF ?>">
          <div class="shufflyTF">
            <input name="<?php echo $questionOptions; ?>" id="inpTfRadio1" type="radio" value="<?php echo $getQuestion['option1'] ?>">
            <label id="lblTfRadio1" for="inpTfRadio1"> <?php echo $getQuestion['option1'];?> </label>
          </div>
          <div class="shufflyTF">
            <input name="<?php echo $questionOptions; ?>" id="inpTfRadio2" type="radio" value="<?php echo $getQuestion['option2'] ?>">
            <label id="lblTfRadio2" for="inpTfRadio2"> <?php echo $getQuestion['option2'] ?> </label>
          </div>
        </div>
      </div>
      <div id="checkboxQuestion" style="display:<?php echo $displayCB ?>">
        <div class="shufflyCB">
          <input name="<?php echo $questionOptions; ?>" id="inpCbCheckbox1" type="checkbox"   value="<?php echo $getQuestion['option1'] ?>">
          <label id="lblCbCheckbox1" for="inpCbCheckbox1"> <?php echo $getQuestion['option1'];?> </label>
        </div>
        <div class="shufflyCB">
          <input name="<?php echo $questionOptions; ?>" id="inpCbCheckbox2" type="checkbox"  value="<?php echo $getQuestion['option2'] ?>">
          <label id="lblCbCheckbox2" for="inpCbCheckbox2"> <?php echo $getQuestion['option2'] ?> </label>
        </div>
        <div class="shufflyCB">
          <input name="<?php echo $questionOptions; ?>" id="inpCbCheckbox3" type="checkbox"  value="<?php echo $getQuestion['option3'] ?>">
          <label id="lblCbCheckbox3" for="inpCbCheckbox3"> <?php echo $getQuestion['option3'] ?> </label>
        </div>
        <div class="shufflyCB">
          <input name="<?php echo $questionOptions; ?>" id="inpCbCheckbox4" type="checkbox"   value="<?php echo $getQuestion['option4'] ?>">
          <label id="lblCbCheckbox4" for="inpCbCheckbox4"> <?php echo $getQuestion['option4'] ?> </label>
        </div>
      </div>
      <input type="hidden" name="attempt" value="<?php echo $_SESSION['attempt'] ?>">
      <input type="hidden" name="num" value="<?php echo $num ?>">
      <input type="hidden" name="score" value="<?php echo $score ?>">
      <input type="hidden" name="checkAnswer" value="TRUE">
      <input type="submit" id="submitAnswer" value="Check Answer" class="btn">
    </form>
  </div>
</div>
<div class="alert hidden"> </div>
</div>
<div id="info">
  <p class='smiling'>Your score:<?php echo $_SESSION['score'];?></p>
  <p class='smiling'>This is attempt number:<?php echo $_SESSION['attempt'];?></p>
</div>
</body>
</html>